package thread;

/**
 * 线程优先级
 * 线程有10个优先级1-10,1是最低，10最高，5是默认值
 *
 */
public class PriorityDemo {
    public static void main(String[] args) {
        Thread min = new Thread(){
            @Override
            public void run(){
                for (int i = 0; i < 10000; i++) {
                    System.out.println("min");
                }
            }
        };
        Thread norm = new Thread(){
            @Override
            public void run(){
                for (int i = 0; i < 10000; i++) {
                    System.out.println("nor");
                }
            }
        };
        Thread max = new Thread(){
            @Override
            public void run(){
                for (int i = 0; i < 10000; i++) {
                    System.out.println("max");
                }
            }
        };
        min.setPriority(Thread.MIN_PRIORITY);
        max.setPriority(Thread.MAX_PRIORITY);
        min.start();
        norm.start();
        max.start();
    }
}
